<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@taglib prefix="sf" uri="http://www.springframework.org/tags/form"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>留言板</title>
</head>
<body>
	<sf:form method="post" modelAttribute="message">
		<div class="input-group">
			<sf:textarea path="message" class="form-control" rows="3"
				cssStyle="resize:none;" placeholder="留下点什么...." />
			<sf:hidden path="user.id" value="${loginUser.id}"
				class="form-control" />
			<span class="input-group-btn"> <sf:button
					class="btn btn-info btn-lg">留<br>言</sf:button>
			</span>
		</div>
	</sf:form>
	<br>
		${messageCount}&nbsp;条建议
	<table class="table ">

		<c:forEach items="${messages }" var="message">
			<tr>
				<td width="51px"><img src="${message.user.avatar }"
					alt="${message.user.username }" height="50px" width="50px"
					class="img-circle" /></td>
				<td><a href="${message.user.id }">${message.user.username }</a><br>
					&nbsp;&nbsp;&nbsp;&nbsp;${message.message } <br> <fmt:formatDate
						value="${message.time }" pattern="yyyy年MM月dd日" /></td>
			</tr>
		</c:forEach>
	</table>
	<nav class="pull-right">

					<ul class="pagination pagination-lg">
						<li><a
							href="./${url }?pageNo=${pageNo - 1}"
							aria-label="Previous"> <span aria-hidden="true">&laquo;</span>
						</a></li>
						<c:forEach begin="0" end="9" var="a">
							<c:set var="apageNo">
								<fmt:formatNumber type="number"
									value="${(pageNo - pageNo%10)/10 }" maxFractionDigits="0"
									pattern="#" />${a%10}
							</c:set>
							<c:if test="${apageNo != 0 }">
								<li <c:if test="${pageNo == apageNo }">class="active"</c:if>><a
									href="./${url }?pageNo=${apageNo}">${apageNo } </a></li>
							</c:if>
						</c:forEach>
						<li><a href="./${url }?pageNo=${pageNo + 1}"
							aria-label="Next"> <span aria-hidden="true">&raquo;</span>
						</a></li>
					</ul>
				</nav>
</body>
</html>